import { createApp } from 'vue'
import "bootstrap/dist/css/bootstrap.css"

import router from "./router"
import Emitter from 'tiny-emitter'
import ElementPlus from 'element-plus' //引入 element￾plus 库
import VForm3 from 'vform3-builds' //引入 VForm3 库
import zhCn from 'element-plus/es/locale/lang/zh-cn'

import 'element-plus/dist/index.css' //引入 element-plus 样式
import 'vform3-builds/dist/designer.style.css' //引入VForm3样式
import axios from "./axios.js"//导入axios库
// import App from './App25.vue'
import i18n from './locals'//导入国际化
import App from './App.vue'
var userPermissions = [];
var app = createApp(App);

app.config.globalProperties.$per = userPermissions;
app.config.globalProperties.$bus = new Emitter();
//设置axios全局变量
window.https = axios;
//生效路由

app.use(router);
app.use(ElementPlus,{locale: zhCn}) ;//全局注册 element-plus
app.use(VForm3);
//国际化注册
app.use(i18n);
app.directive('hasPermission', {
    mounted: function (el, binding, vnode) {
        const { value } = binding;
        // console.info("userPermissions:" + userPermissions);
        let f = userPermissions.some(function (item) {
            return item.indexOf(value) !== -1;
        });
        if (!f) {
            if (el.parentNode) {
                   el.parentNode.removeChild(el);
            }
        }
    }
});
app.mount('#app')